package com.lry.netty01.server.processor;

import com.lry.netty01.server.entity.FixedFrame;
import com.lry.netty01.server.utils.CommandUtil;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HeartBeatRequestProcessor implements RequestProcessor {

    private RequestProcessor next;

    public HeartBeatRequestProcessor(RequestProcessor next) {
        this.next = next;
    }

    @Override
    public boolean processRequest(Channel channel, FixedFrame fixedFrame) {
        if(fixedFrame.getCmd()== CommandUtil.HEART_BEAT_CMD) {
            short devId = fixedFrame.getDevId();
            log.info("收到"+devId+"的心跳报文");
            return true;
        }else{
            return next.processRequest(channel,fixedFrame);
        }
    }


}
